﻿using System.Diagnostics;
using System.Text.RegularExpressions;

namespace ZGDisassembler.UI;

internal class Utils
{
	internal static uint? CheckNumber(string text)
	{
		text = text.Trim();
		var match = Regex.Match(text.Trim(), "(?<hex>^0[xX][0-9a-fA-F]+)|(?<dec>^[0-9]+)");
		if (!match.Success)
			return null;

		if (match.Groups["hex"].Success)
			return Convert.ToUInt32(text, 16);
		else
			return Convert.ToUInt32(text);
	}

	internal static void GetFileLocation(string filePath)
	{
		if (File.Exists(filePath))
			Process.Start("explorer.exe", "/select, " + filePath);
		
	}
}
